package main

import (
	"common/config"
	"common/metrics"
	"context"
	"flag"
	"gate/app"
	"log"
	"os"
)

var fileName = flag.String("conf", "application.yml", "conf file name")

func main() {
	// 1. 加载配置
	flag.Parse()
	config.InitConfig(*fileName)
	//2. 监控服务
	go func() {
		metrics.Serv(config.Conf.MetricPort)
	}()
	//3. 启动http服务
	err := app.Run(context.Background())
	if err != nil {
		log.Println(err)
		os.Exit(-1)
	}

}
